home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / wpjv1n3.zip / PAINT.ZIP / PAINT.CPP next >
C/C++ Source or Header  |  1993-02-24  |  2KB  |  73 lines

  1. //
  2. //    PAINT Object Test
  3. //    Written by Andrew Bradnan (c) 1993
  4. //
  5.  
  6. #define STRICT
  7. #include <windows.h>
  8. #include "paint.h"
  9.  
  10. char szAppName[] = "DC Test" ;
  11. long FAR PASCAL _export WndProc (HWND, UINT, UINT, LONG) ;
  12.  
  13. int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)
  14. {
  15.     HWND        hWnd ;
  16.     MSG         msg ;
  17.     WNDCLASS    wc ;
  18.  
  19.     if (!hPrevInstance) {
  20.         wc.style         = CS_HREDRAW | CS_VREDRAW ;
  21.         wc.lpfnWndProc   = WndProc ;
  22.         wc.cbClsExtra    = 0 ;
  23.         wc.cbWndExtra    = 0 ;
  24.         wc.hInstance     = hInstance ;
  25.         wc.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
  26.         wc.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
  27.         wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
  28.         wc.lpszMenuName  = NULL ;
  29.         wc.lpszClassName = szAppName ;
  30.  
  31.         RegisterClass (&wc) ;
  32.     };
  33.  
  34.     hWnd = CreateWindow (szAppName,        // window class name
  35.         "DC Test Program",            // window caption
  36.         WS_OVERLAPPEDWINDOW,    // window style
  37.         CW_USEDEFAULT,    // initial x position
  38.         CW_USEDEFAULT,    // initial y position
  39.         CW_USEDEFAULT,    // initial x size
  40.         CW_USEDEFAULT,    // initial y size
  41.         NULL,            // parent window handle
  42.         NULL,            // window menu handle
  43.         hInstance,        // program instance handle
  44.         NULL);            // creation parameters
  45.  
  46.     ShowWindow (hWnd, nCmdShow);
  47.     UpdateWindow (hWnd);
  48.  
  49.     while (GetMessage (&msg, NULL, 0, 0)) {
  50.         TranslateMessage (&msg) ;
  51.         DispatchMessage (&msg) ;
  52.     };
  53.     return msg.wParam ;
  54. };
  55.  
  56. long FAR PASCAL _export WndProc (HWND hWnd, UINT message, UINT wParam, LONG lParam)
  57. {
  58.      switch (message) {
  59.         case WM_PAINT:
  60.         {
  61.             PAINT    Paint (hWnd);    // PAINT constructor called here!!
  62.             DrawText (Paint, "PAINT Test!!", -1, Paint, DT_SINGLELINE | DT_CENTER | DT_VCENTER);        // PAINT operator LPRECT () called too!!
  63.         };                // PAINT destructor called here!!
  64.         return 1;        // Everything Created OK
  65.     case WM_DESTROY:
  66.         PostQuitMessage (0);
  67.         return 0;
  68.     };
  69.  
  70.     return DefWindowProc (hWnd, message, wParam, lParam) ;
  71. };
  72.  
  73.